#!/bin/sh
# PCP QA Test No. 799
# checkout pmlogrewrite -q
#
# Copyright (c) 2019 Ken McDonell.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

status=1	# failure is the default!
$sudo rm -rf $tmp $tmp.* $seq.full
trap "_cleanup; exit \$status" 0 1 2 3 15

# real QA test starts here
echo "log mandatory on once {" >$tmp.config
pminfo \
| sed \
    -e 's/\..*//' \
| sort \
| uniq >>$tmp.config
echo "}" >>$tmp.config

pmlogger -l $tmp.log -c $tmp.config -s 1 $tmp

echo "values in the archive ..." >>$seq.full
pmdumplog $tmp \
| grep ' value ' \
| wc -l >>$seq.full

pmlogrewrite -c $PCP_VAR_DIR/config/pmlogrewrite -Dappl0,appl3 -q -i $tmp 2>&1

# success, all done
status=0
exit
